<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>位置</title>
	<style type="text/css">
		*{
			margin: 0px;
			padding:0px;
		}

		#box{
			width: 200px;
			height: 200px;
			background: red url() 0 0 no-repeat;
			padding-top: 100px;
			position: relative;
		}

		#son{
			width: 100px;
			height: 100px;
			background: #A349A4 url() 0 0 no-repeat;
			margin-left: 300px;
			position: absolute;
			top:55px;
		}
		body{
			height: 5000px;
			background: #FF7F27 url() 0 0 no-repeat;
		}
		#top{
			width: 100%;
			height: 50px;
			background: #DD3131 url() 0 0 no-repeat;
			position:fixed;
			top:0px;
			left: 0px;
			display: none;
		}
		.out{
			width: 100%;
			height: 640px; 
			position: fixed;
			overflow: hidden;
		}
		ul{
			width: 100%;
			float: left;
			position: absolute;
			top:0px;
			left: 0px;
		}

		ul li{
			width: 100%;
			height: 640px;
			float: left;
			color: #fff;
			font-size: 50px;
		}
		.box1{
			background: red url() 0 0 no-repeat;
		}
		.box2{
			background: blue url() 0 0 no-repeat;
		}
		.box3{
			background: #FFF200 url() 0 0 no-repeat;
		}
		.box4{
			background: #7092BE url() 0 0 no-repeat;
		}
		.box5{
			background: #880015 url() 0 0 no-repeat;
		}
		.box6{
			background: #7F7F7F url() 0 0 no-repeat;
		}

	</style>
	<script type="text/javascript">

		window.onload = function  () {
			xbs  = document.getElementById('xbs');
		}

		num =0;

		time =0;

		c =0;

		beforeTop =0;
		function run () {
			currentTop = document.body.scrollTop;

			if(currentTop>beforeTop){
				c=0;
				beforeTop =currentTop;
			}else{
				c=1;
				beforeTop =currentTop;
			}

			if(c){
				num--;
			}else{
				num++;
			}

			xbstop = num*-640;

			xbs.style.top=xbstop+"px";


			// document.body.scrollTop=xbstop;

			// document.title=xbstop;
		}
		window.onscroll = function  (argument) {

			clearInterval(time);

			time = setTimeout(run, 500);

			

			// document.body.scrollTop = top;
			// var son = document.getElementById('son');
			// alert(son.style.width);
			// alert(son.offsetWidth);

			// var top = document.getElementById('top');

			// var scrollTop=document.body.scrollTop; 
			// if(scrollTop>600){
			// 	top.style.display="block";
			// }else if(scrollTop<600){
			// 	top.style.display="none";
			// }

			
		}


	</script>

</head>
<body>
	<!-- <div id="box">
		<div id="son" style="width:300px;">
			
		</div>
	</div>
	<div id="top">
		
	</div> -->
	<div class="out">

		<ul id="xbs">
			<li class="box1">1</li>
			<li class="box2">2</li>
			<li class="box3">3</li>
			<li class="box4">4</li>
			<li class="box5">5</li>
			<li class="box6">6</li>
		</ul>
		
	</div>
	
</body>
</html>